package com.fumasoft.dynamic.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 阿里云OSS配置.
 *
 * @Auther jingchen
 * @Date 2025/08/30
 */
@Configuration
@ConfigurationProperties(value = "oss")
@Data
public class OssConfig {

    private String endpoint;

    private String accessKeyId;

    private String accessKeySecret;

    private String bucketName;

    /**
     * 初始化阿里云OSS.
     *
     * @return OSS
     */
    @Bean
    public OSS init() {
        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }
}
